<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      /* 一般来说是子绝父相,因为绝对定位会脱离文档流的关系,但是如果只要有定位属性
      子元素的绝对定位就会根据最近的有定位属性的盒子作为参考
      */
      .box {
        background-color: red;
        width: 500px;
        height: 500px;
        position: absolute;
        top: 50px;
      }
      .box div {
        width: 200px;
        height: 200px;
      }
      .box-child1 {
        background-color: aquamarine;
        position: absolute;
        bottom: -100px;
        right: -100px;
      }
      .box-child2 {
        background-color: beige;
      }
    </style>
  </head>
  <body>
    <div class="box">
      <div class="box-child1">盒子1</div>
      <div class="box-child2">盒子2</div>
    </div>
    <div style="background-color: aquamarine">123</div>
  </body>
</html>
